package com.iclub.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;

@Controller
@RequestMapping("/mer")
public class MerchantController extends BaseController{



	// 获取商户列表
	@RequestMapping("/getMerchantList.do")
	public void selectMerchantList(HttpServletRequest request,
			HttpServletResponse response, String pagenow, String pageSize)
			throws IOException {
		// 获取page和pagesize
		Map<String, String> req = new HashMap<String, String>();
		
		if(pagenow!=null&&pageSize!=null){
			int size=Integer.parseInt(pageSize);
			req.put("pageStart", (String.valueOf((Integer.parseInt(pagenow)-1)*size)));
			req.put("pageSize", pageSize);
		}
		log_detail.info("[获取商户列表] 客户端请求数据为：" + req);
		Map<String, Object> res = merchantServiceImpl.selectMerchantList(req);
		String json = JSON.toJSONString(res);
		log_detail.info("[获取商户列表] 服务端响应数据为：" + json);
		response.setCharacterEncoding("utf-8");
		response.getWriter().write(json);
	}

}
